-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AAS Thumbnail operations #150
Conversation
AAS thumbnail operation Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
@Test | ||
public void uploadThumbnailToShell() throws IOException { | ||
createDummyAasOnServer(getAas1JSONString()); | ||
CloseableHttpResponse getThumbnailResponse = uploadThumbnail(dummyAasId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close the response
|
||
@Test | ||
public void getFileFromNotExistElement() throws FileNotFoundException, UnsupportedEncodingException, ClientProtocolException, IOException { | ||
CloseableHttpResponse response = BaSyxHttpTestUtils.executeGetOnURL(BaSyxHttpTestUtils.getThumbnailAccessURL(getURL(), dummyAasId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close the response
|
||
@Test | ||
public void deleteNonExistingThumbnail() throws FileNotFoundException, UnsupportedEncodingException, ClientProtocolException, IOException { | ||
CloseableHttpResponse response = BaSyxHttpTestUtils.executeDeleteOnURL(BaSyxHttpTestUtils.getThumbnailAccessURL(getURL(), dummyAasId)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close the response
@Override | ||
public ResponseEntity<Resource> getThumbnailAasRepository(Base64UrlEncodedIdentifier aasIdentifier) { | ||
try { | ||
FileInputStream fileInputStream = new FileInputStream(aasRepository.getThumbnail(aasIdentifier.getIdentifier())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
close inputstream
throwIfFilePathIsNotValid(aasId, filePath); | ||
} | ||
|
||
private static void throwIfFilePathIsNotValid(String aasId, String filePath) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move private methods to bottom of the file
ThumbnailHandler.setNewThumbnail(this, aasId, contentType, filePath); | ||
} | ||
|
||
private void updateThumbnailFile(String aasId, String fileName, String contentType, InputStream inputStream, Resource thumbnail) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move private methods to the bottom of the file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, move to thumbnailHandler?
setAssetInformation(aasId, assetInfor); | ||
} | ||
|
||
private void deleteThumbnailFile(Resource thumbnail) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to ThumbnailHandle?
ThumbnailHandler.updateThumbnail(this, aasId, contentType, filePath); | ||
} | ||
|
||
private String createFile(String aasId, String fileName, InputStream inputStream) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to ThumbnailHandler?
Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
Signed-off-by: Zai Müller-Zhang <[email protected]>
Approved |
No description provided.